Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ufo

Package Overview
Dependencies
Maintainers
3
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ufo

URL utils for humans

  • 0.6.12
  • 0.6x
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.1M
decreased by-18.27%
Maintainers
3
Weekly downloads
 
Created

What is ufo?

The ufo npm package provides utilities for URL formatting and normalization. It helps in parsing, resolving, and normalizing URLs, as well as providing utilities for handling query parameters.

What are ufo's main functionalities?

Parsing and normalizing URLs

This feature allows you to normalize URLs, which includes removing the default port for HTTP and HTTPS, decoding unnecessary percent-encoded characters, and removing duplicate slashes.

const { normalizeURL } = require('ufo');
const normalizedUrl = normalizeURL('http://example.com:80/path/');

Handling query parameters

This feature enables you to easily add query parameters to a URL, which can be useful for constructing URLs with dynamic query strings.

const { withQuery } = require('ufo');
const urlWithQuery = withQuery('http://example.com', { query: 'value' });

Joining URLs

This feature is used to concatenate URL parts safely, ensuring that there are no duplicate slashes and that the query string is properly appended.

const { joinURL } = require('ufo');
const fullUrl = joinURL('http://example.com', '/path', '?query=value');

Other packages similar to ufo

FAQs

Package last updated on 31 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc